import java.util.Arrays;

/**
 * @Author 12629
 * @Date 2022/4/28 20:05
 * @Description：
 */
public class Test2 {

    public static void func1(int[] array) {
        array = new int[]{1,2,3};
    }
    public static void func2(int[] array) {
        array[0] = 99;
    }

    public static void main(String[] args) {
        int[] array = {9,8,7};
        func1(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+ " ");
        }
        System.out.println();
        System.out.println("===========");
        func2(array);
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+ " ");
        }
        System.out.println();


    }


    public static void main9(String[] args) {
        /*int a = 10;
        int b = 20;
        a = b;
        System.out.println(a);*/
        int[] array1 = {1,2,3,4};

        int[] array2 = {7,8,9};
        array2 = array1;

        int a = 0;
        System.out.println(a);

        int[] array3 = null;
        System.out.println(array3[0]);

    }


    public static void main8(String[] args) {
        int[] array1 = new int[3];
        array1[0] = 10;
        array1[1] = 20;
        array1[2] = 30;
        int[] array2 = new int[]{1,2,3,4,5};
        array2[0] = 100;
        array2[1] = 200;
        array1 = array2;
        array1[2] = 300;
        array1[3] = 400;
        array2[4] = 500;
        for (int i = 0; i < array2.length; i++) {
            System.out.println(array2[i]);
        }
    }
    public static void main6(String[] args) {
        int a = 10;
        int b = 20;
        int[] array = {1,2,3,4,5};
    }


    public static void main5(String[] args) {
        int[] array = {1,2,3,4,5};
        for (int i = 0; i < array.length; i++) {
            System.out.print(array[i]+" ");
        }
        System.out.println();
        System.out.println("========for each=======");
        for(int x : array) {
            System.out.print(x+" ");
        }
        System.out.println();
        System.out.println("=======Arrays=toString=======");
        //为了让我们更好的去操作数组，提供了一系列的方法，这些方法在工具类Arrays当中
        String ret = Arrays.toString(array);//将你传进来的数组，以字符串的形式进行输出
        System.out.println(ret);
    }

    public static void main4(String[] args) {
        boolean[] f = new boolean[2];
        System.out.println(f[0]);

    }

    public static void main3(String[] args) {
        int[] array = {1,2,3,4,5};
        //array = {1,2,3,4,5};

        System.out.println(array[3]);
        /*array[0] = 99;
        System.out.println(array[0]);*/
        System.out.println(array.length);
    }

    public static void main2(String[] args) {
        //如果你想组织一组数据，这组数据都是相同数据类型的
        int[] array = {1,2,3,4,5};
        System.out.println("array  :" + array);
        int[] array2 = new int[]{1,2,3,4,5};

        int[] array3 = new int[5];
        array3[0] = 189;
        array3[1] = 289;

    }

    public static void main1(String[] args) {
        int a1 = 1;
        int a2 = 2;
        int a3 = 3;

    }
}
